import React, { Component } from 'react'
import { channel } from '../../api/channel'

export default class index extends Component {
  state = {
    chanelList: []
  }
  getChannelData = async () => {
    const res = await channel()
    this.setState({
      chanelList: res.data
    })
  }
  componentDidMount () {
    this.getChannelData()
  }
  render () {
    return (
      <div>
        <ul>
          {this.state.chanelList.map(item => {
            return <li key={item.id}>{item.name}</li>
          })}
        </ul>
      </div>
    )
  }
}
